#ifndef DIALOG_H
#define DIALOG_H

#include <QWidget>
#include <QPicture>
#include <QTimer>
#include <QLabel>


enum LED_COLOUR
{
    BLUE,
    RED,
    PURPLE,
    YELLOW,
    GREEN,
    GRAY
};

class LedControl : public QWidget
{
    Q_OBJECT
    
public:
    explicit LedControl(QWidget *parent = 0,LED_COLOUR colour=RED);
    ~LedControl();
    void flash(uint ms);
    void stop_flash(bool onoroff=false);
    void power(bool onoroff);
    QString name();
    void setname(QString &str);
private:
    void paintEvent(QPaintEvent *);
    void resizeEvent(QResizeEvent *);
    QSize sizeHint() const
    {
        return QSize(20,20);
    }
    int w;
    int h;

    QPixmap ledpixmap;
    QPixmap grayled;
    QTimer* timer;
    LED_COLOUR ledcolour;
    bool b;
    QString namestr;
private slots:
    void time_done();

};

#endif // DIALOG_H
